//
//  Course.m
//  Courses
//
//  Created by xxx on 15/1/4.
//  Copyright (c) 2015年 wtf. All rights reserved.
//

#import "Course.h"
#import "ASIHTTP.h"

@implementation Course

- (id)initWithJsonDict:(NSDictionary *)jsonDict
{
    if (self = [super init])
    {
        self.courseId = jsonDict[@"courseId"];
        self.courseName = jsonDict[@"courseName"];
        self.teacherName = jsonDict[@"teacherName"];
        self.teacherTitle = jsonDict[@"teacherTitle"];
        self.teacherHeadPhotoUrl = jsonDict[@"teacherHeadPhotoUrl"];
        if (self.teacherHeadPhotoUrl.length == 0)
            self.teacherHeadPhotoUrl = jsonDict[@"headPhotoUrl"];
        self.favoritesNum = jsonDict[@"favoritesNum"];
        self.courseViewNum = jsonDict[@"courseViewNum"];
        if (self.courseViewNum.length == 0)
            self.courseViewNum = jsonDict[@"coursefavoritesNum"];
        self.courseDescription = jsonDict[@"courseDescription"];
        self.teacherId = jsonDict[@"teacherId"];
    }
    return self;
}

@end
